Post

Replies

Boosts

Views

Activity

Reply to Updating Time - SwiftUI
This is documented behavior for timers. Timer events are coalesced for efficiency. The delay will increase when the system is busy doing higher-priority things. One simple workaround is to adjust the tolerance - https://developer.apple.com/documentation/foundation/nstimer#1667624 or just update more often (every half-second for better 1-second resolution?). Though, “The system reserves the right to apply a small amount of tolerance to certain timers regardless of the value of this property.”, according to the docs. For SwiftUI it would be wise to update the state (and trigger the view update) only if the actual displayed time has changed when the timer fires. Still, if the system is busy, you’ll notice stutter.
Aug ’20